﻿<Window x:Class="Ricciolo.PaperBoy.UI.FeedSettingsForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Feed properties" Height="450" Width="370"
    WindowStyle="SingleBorderWindow"
    ResizeMode="NoResize" WindowStartupLocation="CenterOwner"
    ShowInTaskbar="False"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    >
  <Grid FocusManager.FocusedElement="{Binding ElementName=name}">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <Label Grid.Row="0" Grid.Column="0" Margin="6,6,6,0" Target="{Binding ElementName=name}">_Name</Label>
    <TextBox Grid.Row="0" Grid.Column="1" Margin="6,6,6,0" Text="{Binding Name}" x:Name="name"></TextBox>

    <Label Grid.Row="1" Grid.Column="0" Margin="6,6,6,0" Target="{Binding ElementName=address}">A_ddress</Label>
    <TextBox Grid.Row="1" Grid.Column="1" Margin="6,6,6,0" Text="{Binding Path=Address,Mode=OneWay}" x:Name="address" IsReadOnly="True" />

    <GroupBox Grid.Row="2" Grid.Column="0" Margin="6,6,6,0" Grid.ColumnSpan="2" Header="Update schedule">
      <StackPanel>
        <TextBlock Margin="6,6,6,0" TextWrapping="WrapWithOverflow">Your computer checks this feed for new updates on a specified schedule.</TextBlock>
        <RadioButton Margin="6,6,6,0" Content="Use d_efault schedule" IsChecked="{Binding IsDefaultSync}" />
        <Label Margin="17,0,6,0">
          <TextBlock>
            <TextBlock>Default: </TextBlock>
            <TextBlock Text="{Binding Path=DefaultInterval,Mode=OneWay}" />
          </TextBlock>
        </Label>
        <RadioButton Margin="6,6,6,0" IsChecked="{Binding IsCustomSync}" Content="Use c_ustom schedule" />
        <DockPanel IsEnabled="{Binding IsCustomSync}">
          <Label Margin="17,0,0,0" Target="{Binding ElementName=frequency}">_Frequency</Label>
          <ComboBox x:Name="frequency" ItemsSource="{Binding Intervals}" SelectedValue="{Binding Interval}" DisplayMemberPath="Description" SelectedValuePath="Value" />
        </DockPanel>
        <CheckBox Margin="6,6,6,0" IsChecked="{Binding DownloadEnclosuresAutomatically}" Content="_Automatically download attached files" />
      </StackPanel>
    </GroupBox>

    <GroupBox Grid.Row="3" Grid.Column="0" Margin="6,6,6,0" Grid.ColumnSpan="2" Header="Archive">
      <StackPanel>
        <TextBlock Margin="6,6,6,0" TextWrapping="WrapWithOverflow">Set the maximum number of updates you want saved for this feed. Changes take effect when the feed is updated.</TextBlock>
        <RadioButton Margin="6,6,6,0" IsChecked="{Binding IsKeepAllItems}">
          <TextBlock>
            <AccessText>
              Keep _maximum items
            </AccessText>
            <AccessText Text="{Binding ItemCountLimit}" />
          </TextBlock>
        </RadioButton>
        <RadioButton Margin="6,6,6,0" Content="Keep the most _recent items only" IsChecked="{Binding IsKeepCustomItems}" />
        <StackPanel Orientation="Horizontal" IsEnabled="{Binding IsKeepCustomItems}">
          <Label Margin="17,0,0,0" Target="{Binding ElementName=items}">Num_ber of</Label>
          <TextBox x:Name="items" Text="{Binding MaxItemCount}" Width="50" />
        </StackPanel>
      </StackPanel>
    </GroupBox>

    <StackPanel Margin="6,6,6,0" Grid.Row="4" Grid.ColumnSpan="2" Grid.Column="0" HorizontalAlignment="Right" Orientation="Horizontal">
      <Button Width="70" Content="_OK" IsDefault="True" Command="ApplicationCommands.Close" />
      <Button Width="70" Margin="6,0" IsCancel="True" Content="_Cancel" />
    </StackPanel>

  </Grid>
</Window>
